#ifndef VIDEOMODEL_H
#define VIDEOMODEL_H

#include <QAbstractListModel>
#include <QPixmap>

struct VIDEO {
    QString strText;    // 视频名称
    QString strPath;    // 视频路径
    bool bSelect;       // 是否选中
};

class VideoModel : public QAbstractListModel
{
    Q_OBJECT
public:
    static VideoModel * getInstance();
    
    enum Roles {
        TextRole = Qt::UserRole + 1,
        PathRole,
        SelectRole
    };
    
    // 插入新视频
    void insertVideo(const QString& videoPath);
    // 删除选中的视频
    void deleteSelectedVideos();
    void setSelect(int nIndex, bool select);
    // 全选/取消全选
    void selectAll(bool select);
    
    int rowCount(const QModelIndex &parent = QModelIndex()) const override;
    QVariant data(const QModelIndex &index, int role) const override;

private:
    explicit VideoModel(QObject *parent = nullptr);
    QVector<VIDEO> m_list;
    static VideoModel * m_pInstance;
};

#endif // VIDEOMODEL_H
